package conexao;


import gui.Geral;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;


public class BibliotecaClient {
	private int porta;
	private String host;
	private Socket server;
	private Geral guiGeral;

	public int getPorta() {
		return porta;
	}

	public void setPorta(int porta) {
		this.porta = porta;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public Socket getServer() {
		return server;
	}

	public void setServer(Socket server) {
		this.server = server;
	}

	public Geral getGuiGeral() {
		return guiGeral;
	}

	public void setGuiGeral(Geral guiGeral) {
		this.guiGeral = guiGeral;
	}
	
	
	public void Conectar() throws IOException {
		try {
			server = new Socket(getHost(), getPorta());
		} catch(UnknownHostException e) {
			System.err.println(e);
			guiGeral.msgErroConn();
		}
		BibliotecaConn cc = new BibliotecaConn(getServer(), getGuiGeral());
		Thread t = new Thread(cc);
		t.start();
		
	}

	
}
